home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1996 May / cd joy 71No13.iso / pc / demos / eurosoc / source / netnow.h < prev    next >
Text File  |  1996-02-12  |  7KB  |  235 lines

  1. /****************************************************************************
  2. *
  3. *  File              : netnow.h
  4. *  Date Created      : 1/18/95
  5. *  Description       : NETNOW! support library header file
  6. *
  7. *  Programmer(s)     : Nick Skrepetos
  8. *  Last Modification : 9/11/95 - 2:40:57 PM
  9. *  Additional Notes  :
  10. *
  11. *****************************************************************************
  12. *            Copyright (c) 1994-95,  HMI, Inc.  All Rights Reserved         *
  13. ****************************************************************************/
  14.  
  15. #ifndef  _HMI_NET_DEFINED
  16. #define  _HMI_NET_DEFINED
  17.  
  18. // equates
  19. #define  _DPMI_INT               0x31
  20.  
  21. // maximum number of allowable nodes
  22. #define  _NETNOW_MAX_NODES       20
  23.  
  24. // broadcast command
  25. #define  _NETNOW_BROADCAST       _NETNOW_MAX_NODES + 1
  26.  
  27. // maximum number of packet in send/listen queue
  28. #define  _NETNOW_MAX_SEND_PACKETS      64
  29. #define  _NETNOW_MAX_LISTEN_PACKETS    64
  30.  
  31. // size of data packet for transmission
  32. #define  _NETNOW_DATA_PACKET           512
  33.  
  34. // filler for alignment
  35. #define  __HMI_FILL(a)  unsigned short a;
  36.  
  37. // real mode interrupt structure
  38. typedef  struct   _tagRMI_REGS
  39.          {
  40.             // system registers
  41.             long  EDI;
  42.             long  ESI;
  43.             long  EBP;
  44.  
  45.             // reserved
  46.             long  reserved_by_system;
  47.  
  48.             long  EBX;
  49.             long  EDX;
  50.             long  ECX;
  51.             long  EAX;
  52.  
  53.             // system flags
  54.             short flags;
  55.  
  56.             // segment registers
  57.             short ES,DS,FS,GS,IP,CS,SP,SS;
  58.  
  59.          }  _RMI_REGS;
  60.  
  61. // set structure packing to byte alignment
  62. #pragma  pack(1)
  63.  
  64. // byte registers
  65. typedef  struct   _tagBREGS
  66.          {
  67.  
  68.             char  al, ah;  unsigned short _1;
  69.             char  bl, bh;  unsigned short _2;
  70.             char  cl, ch;  unsigned short _3;
  71.             char  dl, dh;  unsigned short _4;
  72.  
  73.          } _HMI_BREGS;                
  74.  
  75. // word registers
  76. typedef  struct   _tagWREGS
  77.          {
  78.  
  79.             unsigned short    ax;   unsigned short _1;
  80.             unsigned short    bx;   unsigned short _2;
  81.             unsigned short    cx;   unsigned short _3;
  82.             unsigned short    dx;   unsigned short _4;
  83.             unsigned short    si;   unsigned short _5;
  84.             unsigned short    di;   unsigned short _6;
  85.  
  86.          } _HMI_WREGS;
  87.  
  88. // dword registers
  89. typedef  struct   _tagDREGS
  90.          {
  91.  
  92.             unsigned int   eax;
  93.             unsigned int   ebx;
  94.             unsigned int   ecx;
  95.             unsigned int   edx;
  96.             unsigned int   esi;
  97.             unsigned int   edi;
  98.             unsigned int   cflags;
  99.  
  100.          } _HMI_DREGS;
  101.  
  102.  
  103. // segment registers
  104. typedef  struct   _tagSREGS
  105.          {
  106.  
  107.             unsigned short    es;
  108.             unsigned short    cs;
  109.             unsigned short    ss;
  110.             unsigned short    ds;
  111.             unsigned short    fs;
  112.             unsigned short    gs;
  113.  
  114.          } _HMI_SREGS;
  115.  
  116.  
  117. // general register packet
  118. typedef  union
  119.          {
  120.  
  121.             _HMI_DREGS  x;
  122.             _HMI_WREGS  w;
  123.             _HMI_BREGS  h;
  124.  
  125.          } _HMI_REGS;
  126.  
  127. // reset structure packing
  128. #pragma  pack()
  129.  
  130. // equates for node addition
  131. enum
  132.    {
  133.       _NETNOW_ADD_COMPLETE,
  134.       _NETNOW_ADD_DUPLICATE,
  135.       _NETNOW_ADD_LIST_FULL
  136.    };
  137.  
  138. // equates for node deletion
  139. enum
  140.    {
  141.       _NETNOW_DELETE_COMPLETE,
  142.       _NETNOW_DELETE_INVALID,
  143.    };
  144.  
  145. // error code enumerations
  146. enum
  147.    {
  148.       _NETNOW_NO_ERROR,
  149.       _NETNOW_NO_NETWORK,
  150.       _NETNOW_INIT_ERROR,
  151.       _NETNOW_NO_REALMEM,
  152.       _NETNOW_IPX,
  153.       _NETNOW_NETBIOS,
  154.    };
  155.  
  156. // no node found error code
  157. #define  _NETNOW_NODE_NOT_FOUND     (W32)-1
  158.  
  159. #include "hmiipx.h"
  160. #include "hminetb.h"
  161. #include "hmixfer.h"
  162.  
  163. // set structure packing to byte alignment
  164. #pragma  pack(1)
  165.  
  166. // generic network address
  167. typedef  union 
  168.          {
  169.  
  170.             _IPX_LOCAL_TARGET       sIPX;
  171.             _NETBIOS_LOCAL_TARGET   sNETBIOS;
  172.  
  173.          } _NETNOW_NODE_ADDR;
  174.  
  175. // reset structure packing
  176. #pragma  pack()
  177.  
  178. #endif
  179.  
  180. // function prototypes from IPX/NETBIOS
  181. BOOL    cdecl    hmiIPXGetNetworkAddr       ( _NETNOW_NODE_ADDR * sNode );
  182. W32    cdecl hmiIPXAddNode              ( _NETNOW_NODE_ADDR * sNewNetwork );
  183. W32    cdecl hmiIPXNetAddrToNode        ( _NETNOW_NODE_ADDR * sNetworkAddr );
  184. BOOL    cdecl hmiIPXSendDataDirect       ( PSTR pHeader, W32 wHSize, 
  185.                                          PSTR pData,   W32 wDSize,
  186.                                          _NETNOW_NODE_ADDR * sNode );
  187. BOOL    cdecl    hmiNETBIOSGetNetworkAddr   ( _NETNOW_NODE_ADDR * sNode );
  188. W32    cdecl hmiNETBIOSAddNode          ( _NETNOW_NODE_ADDR * sNewNetwork );
  189. W32    cdecl hmiNETBIOSNetAddrToNode    ( _NETNOW_NODE_ADDR * sNetworkAddr );
  190. BOOL    cdecl hmiNETBIOSSendDataDirect   (  PSTR pHeader, W32 wHSize, 
  191.                                           PSTR pData,   W32 wDSize,
  192.                                           _NETNOW_NODE_ADDR * sNode );
  193.  
  194. // function protoypes from netasm.asm
  195. #ifdef __cplusplus
  196. extern "C" {
  197. #endif
  198. VOID  cdecl hmiINT386x                 ( W32 wInterrupt, _HMI_REGS * sIn, _HMI_REGS * sOut,
  199.                                          _HMI_SREGS * sRegs );
  200. USHORT   cdecl hmiGetDS                ( VOID );
  201. USHORT   cdecl hmiGetCS                ( VOID );
  202. W32     cdecl hmiAllocateLinearMem    ( W32 wSize, W32 * wAddress, W32 * wHandle );
  203. W32     cdecl hmiMapPhysicalToLinear  ( W32 wHandle, W32 wPhysical, W32 wSize );
  204. #ifdef __cplusplus
  205. }
  206. #endif 
  207.  
  208.  
  209. // function prototypes
  210. BOOL    cdecl    hmiNETNOWInitSystem              ( W32 wNodes );
  211. BOOL    cdecl    hmiNETNOWUnInitSystem            ( VOID );
  212. BOOL    cdecl hmiNETNOWAllocateRealMem         ( W32 wSize, PSTR * pPtr, W32 * wSegment );
  213. BOOL    cdecl    hmiNETNOWFindNodes               ( W32 wNodes );
  214. W32    cdecl    hmiNETNOWGetConsoleNode          ( VOID );
  215. W32    cdecl    hmiNETNOWGetActiveNodes          ( VOID );
  216. BOOL    cdecl    hmiNETNOWSendData                ( PSTR pHeader, W32 wHSize,
  217.                                                PSTR pData,   W32 wDSize,
  218.                                                W32 wNode );
  219. BOOL    cdecl    hmiNETNOWSendDataDirect          ( PSTR pHeader, W32 wHSize,
  220.                                                PSTR pData,   W32 wDSize,
  221.                                                _NETNOW_NODE_ADDR * sNode );
  222. BOOL    cdecl    hmiNETNOWGetData                 ( PSTR pHeader, W32 wHSize,
  223.                                                PSTR pData,   W32 wDSize );
  224. W32    cdecl    hmiNETNOWAddNode                 ( _NETNOW_NODE_ADDR * sNode );
  225. W32    cdecl    hmiNETNOWDeleteNode              ( W32 wNode );
  226. W32    cdecl    hmiNETNOWNetAddrToNode           ( _NETNOW_NODE_ADDR * sNodeAddr );
  227. VOID    cdecl    hmiNETNOWSortNodes               ( VOID );
  228. BOOL    cdecl    hmiNETNOWPostListen              ( VOID );
  229. BOOL    cdecl    hmiNETNOWGetNetworkAddr          ( _NETNOW_NODE_ADDR * sNode  );
  230. W32    cdecl    hmiNETNOWGetNetworkType          ( VOID );
  231. BOOL    cdecl    hmiNETNOWGetHeader               ( PSTR pHeader,   W32 wHSize, 
  232.                                                PSTR * pPacket );
  233. VOID    cdecl    hmiNETNOWGetBlock                ( PSTR pPacket, PSTR pData, W32 wDSize );
  234.  
  235.